var yanghuiArr=[];
var str='';
function yanghui(n){
    //行循环
    for(i=0;i<n;i++){
        //对行进行赋初值
        rowArr=[];
        yanghuiArr.push(rowArr);
        //列循环
        for(j=0;j<=i;j++){
            //对数组进行赋值
            if(j===i||j===0){
                yanghuiArr[i][j]=1;   //=赋值  ==判断
            }else{
                yanghuiArr[i][j]=yanghuiArr[i-1][j-1]+yanghuiArr[i-1][j];
            }
            str+=yanghuiArr[i][j]+" ";
        }
        //换行
        str+="/n";
    }
    console.log(str);
}